package com.lg.dao;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public interface EntityDAO<T extends Serializable> {
	final static String COUNTBYEXAMPLE="abatorgenerated_countByExample";
	final static String COUNTBYSTATEMENTID="abatorgenerated_countByStatementId";
	final static String DELETEBYEXAMPLE="abatorgenerated_deleteByExample";
	final static String DELETEBYPRIMARYKEY="abatorgenerated_deleteByPrimaryKey";
	final static String INSERT="abatorgenerated_insert";
	final static String INSERTSELECTIVE="abatorgenerated_insertSelective";
	final static String SELECTBYPRIMARYKEY="abatorgenerated_selectByPrimaryKey";
	final static String SELECTBYEXAMPLE="abatorgenerated_selectByExample";
	final static String UPDATEBYPRIMARYKEY="abatorgenerated_updateByPrimaryKey";
	final static String UPDATEBYPRIMARYKEYSELECTIVE="abatorgenerated_updateByPrimaryKeySelective";
	final static String UPDATEBYEXAMPLE="abatorgenerated_updateByExample";
	final static String UPDATEBYEXAMPLESELECTIVE="abatorgenerated_updateByExampleSelective";
	/**
	 * ����һ�������record�ļ�¼
	 * 
	 * @param record
	 * @throws OtherException
	 * @return
	 */
	Object insert(T record) throws SQLException;

	/**
	 * ����һ�������record�ļ�¼��ֻ����record��Ϊnull������
	 * 
	 * @param record
	 * @throws SQLException
	 * @return
	 */
	Object insertSelective(T record) throws SQLException;
	/**
	 * ��������
	 * @param conllection
	 * @throws SQLException
	 */
	void insertBatch(Collection<T> conllection)throws SQLException;

	/**
	 * ���������¼�¼
	 * 
	 * @param record
	 * @return
	 */
	int updateByPrimaryKey(T record) throws SQLException;

	/**
	 * ���������м�¼��ֻ����record��Ϊnull������
	 * 
	 * @param record
	 * @return
	 */
	int updateByPrimaryKeySelective(T record) throws SQLException;

	/**
	 * ���ģ���ѯ�����ؼ���List<T>
	 * 
	 * @param example
	 * @return
	 */
	<C extends Criteria> List<T> selectListByExample(Example<C> example) throws SQLException;
	/**
	 * ���ģ���ѯ���ӵ�star����ʼ������count����¼
	 * @param example
	 * @param start
	 * @param count
	 * @return
	 * @throws SQLException
	 */
	<C extends Criteria> List<T> selectListByExample(Example<C> example,int start,int count) throws SQLException;

	/**
	 * ���ģ���ѯ�����ض���T
	 * 
	 * @param example
	 * @return
	 */
	<C extends Criteria> T selectObjectByExample(Example<C> example) throws SQLException;

	/**
	 * ��������ѯ�����ض���T
	 * 
	 * @param id
	 * @return
	 */
	T selectByPrimaryKey(T id)throws SQLException;

	/**
	 * ���ģ��ɾ���ɾ��ļ�¼��
	 * @param example
	 * @return
	 */
	<C extends Criteria> int deleteByExample(Example<C> example) throws SQLException;

	/**
	 * �������ɾ��
	 * @param id
	 * @return
	 */
	int deleteByPrimaryKey(T id) throws SQLException;
	

	/**
	 * ���ģ���ѯ��Ӧ����ݼ�¼��
	 * @param example
	 * @return
	 */
	<C extends Criteria> int countByExample(Example<C> example) throws SQLException;
	/**
	 * ���ģ�����record��Ϊnull���ֶΣ����ظ��¼�¼��
	 * @param record
	 * @param example
	 * @return
	 */
	<C extends Criteria> int updateByExampleSelective(T record, Example<C> example) throws SQLException;

	/**
	 * ���ģ�����,���ظ��¼�¼��
	 * @param record
	 * @param example
	 * @return
	 */
	<C extends Criteria> int updateByExample(T record, Example<C> example) throws SQLException;
	/**
	 * ���statementId(sqlmap�е�sqlId)��ѯ
	 * @param statementId
	 * @param param
	 * @return
	 * @throws SQLException
	 */
	List<T> selectListByStatementId(String statementId,Object param)throws SQLException;
	/**
	 * ���statementId(sqlmap�е�sqlId)��ѯ,��start��ʼ������count����¼
	 * @param statementId
	 * @param param
	 * @param start
	 * @param count
	 * @return
	 * @throws SQLException
	 */
	List<T> selectListByStatementId(String statementId,Object param,int start,int count)throws SQLException;
	/**
	 * ���statementId(sqlmap�е�sqlId)��ѯ
	 * @param statementId
	 * @param param
	 * @return
	 */
	T selectObjectByStatementId(String statementId,Object param)throws SQLException;
	/**
	 * ���statementId(sqlmap�е�sqlId)��ѯ��Ӧ����ݼ�¼��
	 * @param statementId
	 * @return
	 */
	int countByStatementId(String statementId,Object param) throws SQLException;
	/**
	 * 根据statementId插入记录
	 * @param statementId
	 * @param param
	 * @return
	 */
	Object insertByStatementId(String statementId,Object param)throws SQLException;
	/**
	 * 根据statementId修改记录
	 * @param statementId
	 * @param param
	 * @return
	 */
	int updateyStatementId(String statementId,Object param)throws SQLException;

	/**
	 * 根据statementId删除记录
	 * @param statementId
	 * @param param
	 * @return
	 */
	int deleteByStatementId(String statementId,Object param)throws SQLException;
	List<String> selectListNameByStatementId(String statementId,Object param)throws SQLException;
}